package pack0901;

public class DemoD {
    public static void main(String[] args) {
        DemoD1 dd1 = new DemoD1();
        DemoD2 dd2 = new DemoD2();
        //setDaemon 后台线程/守护线程--再进程中除了守护线程之外的非守护线程结束，守护线程结束
        dd1.setDaemon(true);
        dd1.start();
        dd2.start();
    }
}
class DemoD1 extends Thread{
    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(1000);

            }catch (Exception e){}
            System.out.println("aaa");
        }
    }
}
class DemoD2 extends Thread{
    @Override
    public void run() {
        try {
            Thread.sleep(8000);
        }catch (Exception e){}
        System.out.println("bbb");
    }
}
